using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using iTron.Model.GridItems;
using iTron.Model;

namespace iTron.View
{
    class BikeView
    {
        public static int SPRITE_HEIGHT = 29, SPRITE_WIDTH = 29;
        private ContentManager cm;
        public Texture2D texture { get; set; }

        public BikeView(ContentManager cm, string sprite)
        {
            this.cm = cm;
            texture = cm.Load<Texture2D>(sprite);
        }

        public Vector2 getPosition(Bike bike, Vector2 position)
        {
            Vector2 newPosition = new Vector2();
            double x = 14.5, y = 14.5;

            x -= (bike.x * 4);
            y -= (bike.y * 4);

            newPosition.X = position.X - (float)y;
            newPosition.Y = position.Y + (float)x;
            return newPosition;
        }

        public Rectangle getRectangle()
        {
            return new Rectangle(0 * SPRITE_WIDTH, 0, SPRITE_WIDTH, SPRITE_HEIGHT);
        }

        public Rectangle getRectangle(int direction)
        {
            return new Rectangle(direction * SPRITE_WIDTH, 0, SPRITE_WIDTH, SPRITE_HEIGHT);
        }
    }
}
